using System.Collections;
using System.Collections.Generic;
using Resources.Scripts.Socket.MyChat.Protocol;
using TMPro;
using UnityEngine;
using UnityEngine.UI;


// public enum MessageType { 
//     World,
//     Friend
// }

public class OneMessage : MonoBehaviour
{
    // private MessageType messageType;
    // private User user;
    // private int userId;
    // private string userName;
    // private string message;


    [SerializeField]
    private Image headImg;
    [SerializeField]
    private TMP_Text userNameText;
    [SerializeField]
    private TMP_Text MessageText;

    public void Init(int id, string userName, string message)
    {
        userNameText.text = userName;
        MessageText.text = message;
    }

    public void Init(ChatMessage chatMessage)
    {
        userNameText.text = chatMessage.FromName;
        MessageText.text = chatMessage.Message;
    }

    void Start()
    {
        headImg = transform.Find("Info/Head/Img").GetComponent<Image>();
        userNameText = transform.Find("Info/NickName/Text").GetComponent<TMP_Text>();
        MessageText = transform.Find("Message/Text").GetComponent<TMP_Text>();
    }


    void Update()
    {
        
    }
}
